using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using oms.Shared.Models;

namespace oms.Modules.System.Models;

/// <summary>
/// 用户角色关联信息
/// </summary>
[Comment("用户角色关联信息")]
public class SysUserRoleEntity : BaseEntity
{
    /// <summary>
    /// 用户ID
    /// </summary>
    [Column("user_id", TypeName = "char(16)")]
    [Comment("用户ID")]
    [Required] // 对应原类的 nullable = false
    public string UserId { get; set; } = string.Empty;

    /// <summary>
    /// 角色ID
    /// </summary>
    [Column("role_id", TypeName = "char(16)")]
    [Comment("角色ID")]
    [Required] // 对应原类的 nullable = false
    public string RoleId { get; set; } = string.Empty;

    /// <summary>
    /// 过期时间
    /// </summary>
    [Column("expire_time", TypeName = "datetime(3)")]
    [Comment("过期时间")]
    public DateTime ExpireTime { get; set; } = new DateTime(9999, 12, 31, 23, 59, 59); // 默认值

    // 复合主键配置（需在DbContext中通过Fluent API补充）
    // 说明：EF Core不支持通过特性配置复合主键，需在OnModelCreating中配置
}